/*年轻人，只管向前看，不要管自暴自弃者的话*/

import 'package:fltlib/page/setting/setting_logic.dart';
import 'package:fltlib/router/router_container.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import '../page/home/home_logic.dart';
import '../page/home/home_view.dart';
import '../page/mine/mine_logic.dart';
import '../page/mine/mine_view.dart';
import '../page/setting/setting_view.dart';
import '../page/user/user_logic.dart';
import '../page/user/user_view.dart';

///create by itz on 2024/1/17 14:11
///desc :
class AppRouteContainer extends MixinRouterContainer
    with HomeRouteContainer, MineRouteContainer, SettingRouteContainer, ConfigRouteContainer {
  AppRouteContainer._();

  static final AppRouteContainer _instance = AppRouteContainer._();

  static AppRouteContainer get share => _instance;
}

mixin HomeRouteContainer on MixinRouterContainer {
  @override
  Map<String, WidgetBuilder> installRouters() {
    Get.lazyPut(() => HomeLogic());
    Map<String, WidgetBuilder> originRoutes = super.installRouters();
    Map<String, WidgetBuilder> newRoutes = {};
    newRoutes['/home'] = (context) => HomePage(); //注册页面
    newRoutes.addAll(originRoutes);
    return newRoutes;
  }
}

mixin MineRouteContainer on MixinRouterContainer {
  @override
  Map<String, WidgetBuilder> installRouters() {
    Get.lazyPut(() => MineLogic());
    Map<String, WidgetBuilder> originRoutes = super.installRouters();
    Map<String, WidgetBuilder> newRoutes = {};
    newRoutes['/mine'] = (context) => MinePage(); //注册页面
    newRoutes.addAll(originRoutes);
    return newRoutes;
  }
}

mixin SettingRouteContainer on MixinRouterContainer {
  @override
  Map<String, WidgetBuilder> installRouters() {
    Get.lazyPut(() => SettingLogic());
    Map<String, WidgetBuilder> originRoutes = super.installRouters();
    Map<String, WidgetBuilder> newRoutes = {};
    newRoutes['/setting'] = (context) => SettingPage(); //注册页面
    newRoutes.addAll(originRoutes);
    return newRoutes;
  }
}

mixin ConfigRouteContainer on MixinRouterContainer {
  @override
  Map<String, WidgetBuilder> installRouters() {
    Map<String, WidgetBuilder> originRoutes = super.installRouters();
    Map<String, WidgetBuilder> newRoutes = {};

    //注册页面
    Get.lazyPut(() => UserLogic());
    newRoutes['/user'] = (context) => UserPage();

    newRoutes.addAll(originRoutes);
    return newRoutes;
  }
}
